package com.yidu.sanrenxing.homedata.service.impl;

import com.yidu.sanrenxing.homedata.dao.ColorMapper;
import com.yidu.sanrenxing.homedata.domain.Color;
import com.yidu.sanrenxing.homedata.service.ColorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ColorServiceImpl implements ColorService {
    @Autowired
    ColorMapper colorMapper2;

    @Override
    public Color selectByPrimaryKey(int colorid) {
        return colorMapper2.selectByPrimaryKey(colorid);
    }

    @Override
    public List selectAll() {
        return colorMapper2.selectAll();
    }

    @Override
    public int deleteByPrimaryKey(int colorid) {
        return colorMapper2.deleteByPrimaryKey(colorid);
    }

    @Override
    public int insert(Color record) {
        return colorMapper2.insert(record);
    }

    @Override
    public int insertSelective(Color record) {
        return colorMapper2.insertSelective(record);
    }

    @Override
    public int updateByPrimaryKeySelective(Color record) {
        return colorMapper2.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Color record) {
        return colorMapper2.updateByPrimaryKey(record);
    }

    /**
     * 根据颜色编号获取颜色名
     * @param colorid
     * @return
     */
    public String getColorName(int colorid){
        Color color=colorMapper2.selectByPrimaryKey(colorid);
        return color.getColorname();
    }
}
